﻿<MNavigationDrawer Value=Show ValueChanged=ShowChanged Fixed Right Temporary Width="300">
    <PrependContent>
        <MContainer>
            <MToolbar Flat Height="80">
                <h5>
                    Settings
                </h5>
            </MToolbar>
        </MContainer>
    </PrependContent>
    <ChildContent>
        <MContainer>
            <h6>Mode</h6>
            <MButtonGroup Mandatory Value=GlobalConfig.PageMode ValueChanged="PageModeChanged" class="mt-1">
                <MButton Value="PageModes.Breadcrumb" Text Width="135">@PageModes.Breadcrumb</MButton>
                <MButton Value="PageModes.PageTab" Text Width="135">@PageModes.PageTab</MButton>
            </MButtonGroup>
        </MContainer>
    </ChildContent>
</MNavigationDrawer>

@code {
    [Parameter]
    public bool? Show { get; set; }

    [Parameter]
    public EventCallback<bool?> ShowChanged { get; set; }

    [Parameter]
    public GlobalConfig GlobalConfig { get; set; }

    [Parameter]
    public EventCallback<GlobalConfig> GlobalConfigChanged { get; set; }

    async Task PageModeChanged(StringNumber value)
    {
        GlobalConfig.PageMode = value.ToString();
        if (GlobalConfigChanged.HasDelegate) await GlobalConfigChanged.InvokeAsync(GlobalConfig);
    }
}